//
//  LFGroupTableViewCell.m
//  LocalLife
//
//  Created by 李立达 on 15/11/25.
//  Copyright © 2015年 heima11. All rights reserved.
//

#import "LFGroupTableViewCell.h"
#import "LFGroupCollectionViewCell.h"
static NSString *collection=@"collectionView";
@interface LFGroupTableViewCell ()<UICollectionViewDelegate,UICollectionViewDataSource>
@property (weak, nonatomic) IBOutlet UICollectionView *groupCollection;

@property (weak, nonatomic) IBOutlet UICollectionViewFlowLayout *layout;


@end
@implementation LFGroupTableViewCell

-(void)setModle:(LFHomeModel *)modle
{
    _modle=modle;
    [_groupCollection reloadData];
}
-(id)init
{
   
   
        self=[[NSBundle mainBundle]loadNibNamed:@"LFGroupTableViewCell" owner:nil options:nil].lastObject;
    return self;
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    _layout.itemSize=CGSizeMake(KscreedWdith/4,(180/2));
    _layout.minimumLineSpacing=0;
    _layout.minimumInteritemSpacing=0;
    _layout.sectionInset=UIEdgeInsetsZero;
    
}
- (void)awakeFromNib {
    
   
    [_groupCollection registerNib:[UINib nibWithNibName:@"LFGroupCollectionViewCell" bundle:nil] forCellWithReuseIdentifier:collection];
    _groupCollection.backgroundColor=[UIColor whiteColor];
    _groupCollection.showsVerticalScrollIndicator=NO;
    _groupCollection.showsHorizontalScrollIndicator=NO;
    _groupCollection.scrollEnabled=NO;
   
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

 
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return self.modle.group.list.count;
}


- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{

    LFGroupCollectionViewCell *cell=[collectionView dequeueReusableCellWithReuseIdentifier:collection forIndexPath:indexPath];
    cell.model=self.modle.group.list[indexPath.row];
    return cell;
}

@end
